package bitCalculation;

import java.util.Arrays;

public class MaximumNumberOfBalloons1189 {
    public int maxNumberOfBalloons(String text) {
        int[] balloon = new int[5];// b\a\l\o\n
        for (int i = 0; i < text.length(); i++) {
            char c = text.charAt(i);
            if(c=='b'){
                balloon[0]++;
            }
            if(c=='a'){
                balloon[1]++;
            }
            if(c=='l'){
                balloon[2]++;
            }
            if(c=='o'){
                balloon[3]++;
            }
            if(c=='n'){
                balloon[4]++;
            }
        }
        balloon[2]/=2;
        balloon[3]/=2;
        return Arrays.stream(balloon).min().getAsInt();
    }
}
